Conventionally, the electronic control unit (ECU) for controlling various parts of a vehicle typically performs diagnosis for detecting a fault of a predetermined diagnosis object and stores, in a semiconductor memory capable of rewriting contents such as an SRAM, an EEPROM or the like, a fault code of the detected fault in case a fault is detected. The semiconductor memory is usually disposed in the ECU. The SRAM is a volatile memory that is configured to have a continuous power supply from a vehicle battery. The EEPROM is a non-volatile memory.
The ECU is, for example, configured to transmit the fault code to an external diagnosis device by reading the code from the SRAM when the ECU receives a fault code request from the external diagnosis device that is communicable through communication channel.
In this case, the fault code lost from the SRAM due to the removal of the vehicle battery causing the loss the power supply, due to a defect in the SRAM or the like is restored by reading the code stored in the EEPROM and writing the code in the SRAM. The fault code may be configured to be read from the EEPROM and to be transmitted to the diagnosis device when the ECU receives the fault code request from the diagnosis device.
The fault code stored in the non-volatile memory may be, for some reason, rewritten or turned to different data in some cases.
In view of the above-described cases, the technique disclosed in, for example, Japanese patent documents JP-A-2005-196515 or JP-A-2006-286111 describes a method for detecting rewritten to fault data and for restoring a correct data from the fault data.
For example, in the description of the patent document JP-A-2005-196515, the method describes how to restore the correct data based on comparison of same data stored in three different places. More practically, the method determines that the data is correct if at least two data out of three match with each other. Three data matching with each other is also considered to be correct. Further, when at least two data out of three are matching, the two matching data are determined to be correct data, and the rest is determined to be incorrect. Furthermore, in the description of the document, the method rewrites the data that has been determined to be correct in a memory area that stores the data that has been determined to be incorrect for data restoration of the correct data from the incorrect data.
The description of JP-A-2006-286111 discloses a similar technical idea.
However, the method and idea in the above-mentioned documents can not determined the correct fault code if the three different memory areas in the non-volatile memory store respectively different fault codes, that is, if the same codes stored in the three different areas are turned to be respectively different three codes.
Therefore, the fault code in the SRAM may not be correctly restored when the fault code in the SRAM is lost. In other words, the fault code request from the external diagnosis device may not have the correct fault code transmitted in response. The fault code directly retrieved from the non-volatile memory does not solve the problem because there is no clue to determine which one of the fault codes in the non-volatile memory is correct.
Further, in a case that at least two fault codes out of three in the non-volatile memory are turned to the incorrect fault codes and the fault codes after being turned accidentally match with each other the incorrect code is considered to be correct. In that case, the ECU transmits the incorrect fault code to the external diagnosis device in response to the fault code request from the diagnosis device.